package com.ruoyi.admin.controller;
import com.ruoyi.app.domain.OrderInfo;
import com.ruoyi.app.service.OrderService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;

/*
@description:订单管理
@ClassName OrderController
@author chen
@create 2025-03-18 21:03
@Version 1.0
*/
@Slf4j
@RestController
@RequestMapping("order")
@AllArgsConstructor
public class OrderController extends BaseController
{
    final OrderService orderService;

    /*
     * @==============History===============<br/>
     * @Description //   查询订单列表
     * @Date 2025-3-18 21:12
     * @Author < a href="15991488967@163.com">chen</ a>
     * @return com.ruoyi.framework.web.page.TableDataInfo
     */
    @GetMapping(value = "/getOrderList",produces = "application/json;charset=utf-8")
    public TableDataInfo getOrderList(@RequestParam Map<String, Object> params)
    {
        startPage();
        List<OrderInfo> list = orderService.getOrderList(params);
        return getDataTable(list);
    }


    /*
     * @==============History===============<br/>
     * @Description //  删除订单(取消订单)
     * @Date 2025-3-18 21:50
     * @Author < a href="15991488967@163.com">chen</ a>
     * @return com.ruoyi.framework.web.domain.AjaxResult
     */
    @DeleteMapping (value = "/deleteOrderInfo", produces = "application/json;charset=utf-8")
    public AjaxResult deleteOrderInfo(@RequestParam("id") Long id)
    {
        return orderService.deleteByPrimaryKey(id);
    }

}
